{% include "../public/min-header.html" %}
<div class="wrapper">
	{% include "../public/breadcrumb.html" %}
	<section class="content">
       <div class="row">
       		<div class="col-xs-12">
	       		<div class="box">
	           	<div class="box-header" style="display: none;">
	               <nav class="navbar navbar-default">
				        <div class="collapse navbar-collapse">
				          <form class="navbar-form form-inline" action="" name="change_System" method="post" enctype="multipart/form-data">
				            <div class="input-group">要导入的SQL文件:</div>
				            <div class="input-group">
				            	 <input type="file" class="btn btn-default" name="sqlfile"/>
				            </div>
				            <div class="form-group"><input type="submit" class="btn btn-primary" value="提交">
				            	<label class="text-danger">导入的SQL语句必须按照MYSQL的语法编写</label>
				            </div>		          
				          </form>		
				      	</div>
	    			</nav>               
	            </div>	    
	             <!-- /.box-header -->
	            <div class="box-body">	             
	           	<div class="row">
	            	<div class="col-sm-12">
	            	<form  method="post" action="">
		              <table class="table table-bordered table-striped">
		                 <thead>
		                   <tr>
			                   <th class="sorting" tabindex="0">文件名称</th>
			                   <th class="sorting" tabindex="0">文件大小</th>
			                   <th class="sorting" tabindex="0">备份时间</th>
			                   <th class="sorting" tabindex="0">操作</th>
		                   </tr>
		                 </thead>
						<tbody>
						  	{% for vo in lists %}
							  	<tr>
			                     	<td>{{vo.name}}</td>
			                     	<td>{{vo.size}}</td>
			                     	<td>{{vo.createTime}}</td>
			                     	<td>
										<a class="btn btn-success" href="javascript:;" onclick="donwload('{{vo.name}}')">下载</a>
			                      		<a class="btn btn-danger setRemove" href="javascript:;" data-post-url="{{helper.pathFor('adtlrt')}}" data-id="{{vo.name}}" data-jump-url="{{helper.pathFor('adtlrt')}}" data-csrf="{{ ctx.csrf | safe }}">删除</a>
									</td>
			                   	</tr>
		                  	{% endfor %}
	                   	</tbody>
	                 	<tfoot>
	                 	</tfoot>
		               </table>
		           </form>
	               </div>
	           </div>
	           	<div class="row">
                	<div class="col-sm-6 text-left">备份文件数量：{{lists.length}}，占空间大小：{{size_total}}</div>
                	<div class="col-sm-6 text-right"></div>		
              	</div>
	          </div>
	        </div>
       	</div>
       </div>
   </section>
</div>
<script type="text/javascript">
	function donwload(name) {
        let _csrf = '{{ ctx.csrf | safe }}';
        let postForm = document.createElement("form");//表单对象
        postForm.method="post" ;
        postForm.action = "{{helper.pathFor('adtlrt')}}" ;
        let actInput = document.createElement("input") ;
        actInput.setAttribute("name", "act") ;
        actInput.setAttribute("value", "down");
        postForm.appendChild(actInput) ;
        let nameInput = document.createElement("input") ;
        nameInput.setAttribute("name", "id") ;
        nameInput.setAttribute("value", name);
        postForm.appendChild(nameInput) ;
        let csrfInput = document.createElement("input");
        csrfInput.setAttribute("name","_csrf");
        csrfInput.setAttribute("value",_csrf);
        postForm.appendChild(csrfInput);

        document.body.appendChild(postForm) ;
        postForm.submit() ;
        document.body.removeChild(postForm) ;
    }
</script>
{% include "../public/main-footer.html" %}